#include <iostream>
#include <string>
#include <vector>

using namespace std;

class Solution {
public:
	bool isAnagram(string s, string t) {
		if (s.length()!=t.length())
			return false;
		for (int i=0;i<s.length();++i)
		{
			for (int j=i;j<t.length();++j)
			{
				if (s[i]==t[j])
				{
					char tmp=t[j];
					t[j]=t[i];
					t[i]=tmp;
					break;
				}
				else if (j==s.length()-1)
					return false;
			}
		}
		return true;
	}
};

int main()
{
	string s="rat";
	string t="car";
	Solution sol;
	bool res=sol.isAnagram(s,t);
	return 0;
}